package com.mjk.common.tools.scheduled.single;

import org.springframework.scheduling.concurrent.CustomizableThreadFactory;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public interface SinglePointInterface {
	/**
	 * 超时线程池
	 */
	ExecutorService timeOutExecutor = Executors.newFixedThreadPool(10, new CustomizableThreadFactory("SinglePointInterface"));
	
	/**
	 * 根节点
	 */
    String ROOT_PATH = "/sechedule";
	/**
	 * 是否是该节点运行
     */
	boolean isSingelRun();
	
	/**
	 * 注册监听
	 */
	void registerListener(String node,DataSingleListener listener);
	/**
	 * 设置通知
	 * @param node 键名称
	 * @param value 值
	 */
	void setNotic(String node,String value);
	/**
	 * 
	 * @param node 键名称
	 * @param value 值
	 * @param timeOut 超时时间
	 */
	void setNotic(String node,String value,long timeOut);
	
	interface DataSingleListener{
		//事件通知
		default void onListener(String node, Object data){}
    }
}
